package com.polaris.live.adapter

import android.annotation.SuppressLint
import com.blankj.utilcode.util.StringUtils
import com.polaris.live.common.adapter.BaseBindingAdapter
import com.polaris.live.common.adapter.VBViewHolder
import com.polaris.live.databinding.AdapterInviteUserItemBinding
import com.polaris.live.resp.back_resp.UserInviteHostListResp
import com.polaris.live.translation.R.string

/**
 * AgencyInviteAdapter
 *
 * @author Created by 半仙 on 2024/4/8/008 15:01
 */
class AgencyInviteAdapter :
    BaseBindingAdapter<AdapterInviteUserItemBinding, UserInviteHostListResp>() {

    @SuppressLint("SetTextI18n")
    override fun convert(
        holder: VBViewHolder<AdapterInviteUserItemBinding>,
        item: UserInviteHostListResp,
    ) {
        holder.vb.apply {
            val user = item.userBasic
            itemAvatarView.setImageUrl(user.avatar)
            itemCountryView.setCountry(user.country)
            itemLevelView.setRichCharmBySexLevel(user.sex, user.richs, user.charms)
            lvLanguage.setLanguage(user.secondLanguage)
            vipView.setVipLevel(user.vipLevel)
            itemUserNickName.text = user.nickname
            if (item.agencyBasic != null) {
                itemUserNickName.text =
                    user.nickname + "(${StringUtils.getString(string.family)}: ${item.agencyBasic.agencyName})"
            }
        }
    }
}